857e77eec2cc02ffd4b4f1f22808ccbe32351e3f,spring-web-reactive/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageReaderArgumentResolver.java,AbstractMessageReaderArgumentResolver,readBody,#MethodParameter#boolean#ServerWebExchange#,118
Before Change
Map<String, Object> hints = (reader instanceof ServerHttpMessageReader ?
((ServerHttpMessageReader<?>)reader).resolveReadHints(bodyType, elementType,
mediaType, exchange.getRequest()) : Collections.emptyMap());
if (reader.canRead(elementType, mediaType, hints)) {
After Change
if (adapter != null && adapter.getDescriptor().isMultiValue()) {
Flux<?> flux = (reader instanceof ServerHttpMessageReader ?
((ServerHttpMessageReader<?>)reader).read(bodyType, elementType,
request, response, Collections.emptyMap()) :
reader.read(elementType, request, Collections.emptyMap())
.onErrorResumeWith(ex -> Flux.error(getReadError(ex, bodyParameter))));
if (checkRequired(adapter, isBodyRequired)) {
flux = flux.switchIfEmpty(Flux.error(getRequiredBodyError(bodyParameter)));
}
if (this.validator != null) {
flux = flux.map(applyValidationIfApplicable(bodyParameter));
}
return Mono.just(adapter.fromPublisher(flux));
}
else {
Mono<?> mono = (reader instanceof ServerHttpMessageReader ?
((ServerHttpMessageReader<?>)reader).readMono(bodyType, elementType,
request, response, Collections.emptyMap()) :
reader.readMono(elementType, request, Collections.emptyMap())
.otherwise(ex -> Mono.error(getReadError(ex, bodyParameter))));
if (checkRequired(adapter, isBodyRequired)) {
mono = mono.otherwiseIfEmpty(Mono.error(getRequiredBodyError(bodyParameter)));